package com.lyh.db137.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lyh.db137.entity.Menu;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
  * @Author: 想要告诉你
  * @CreateTime: 2024/12/24 11:48
  * @Description: 
  * @Version: 1.0
  */
public interface MenuMapper extends BaseMapper<Menu> {
    //根据用户id查询菜单
    @Select("SELECT m.* FROM userrole u INNER JOIN rolemenu r ON u.`roleid` = r.`roleid` INNER JOIN menu m ON r.`menuid` = m.`id` WHERE u.`userid` = #{userId};")
    List<Menu> selectMenuByUserId(@Param("userId") Integer userId);
}